<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css"  media="all">
</head>
<body>
<ul class="layui-nav">
    <li class="layui-nav-item">
        <a href="">控制台<span class="layui-badge">9</span></a>
    </li>
    <li class="layui-nav-item">
        <a href="./ownorder.html">关于我的订单<span class="layui-badge-dot"></span></a>
    </li>
    <li class="layui-nav-item">
        <a href=""><img src="" class="layui-nav-img">我</a>
        <dl class="layui-nav-child">
            <dd><a href="../homeUser.html">主页</a></dd>
            <dd><a href="./../homePage.html">我的信息</a></dd>
            <dd><a href="./riderHome.html">骑手之家</a></dd>
        </dl>
    </li>
</ul>
<script src="../../jQuery/jquery-3.6.0.js"></script>

<table class="layui-hide" id="order" lay-filter="order" ></table>

<script src="../../layui/layui.js" charset="utf-8"></script>

<script>
    layui.use('table', function(){
        var orderform = JSON.parse(localStorage.getItem("username"))
        if (orderform != null){
            customerId = orderform.username
        }
        var table = layui.table;

        table.render({
            elem: '#order'
            ,url:'/order/customerQueryOrder'
            ,where: { 'customerId' : customerId}
            ,cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
            ,page:false
            ,method : 'post'
            ,parseData : function (res) {
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "data": res.data,//解析数据列表
                };
            }
            ,cols: [[
                {field:'id', width:80, title: 'ID' ,sort: true}
                ,{field:'commission', width:100, title: '佣金' }
                ,{field:'orderStatus', width:80, title: '订单状态' ,sort: true}
                ,{field:'receivedAddress', width:150, title: '收件地址'}
                ,{field:'weight', width:120, title: '订单重量',sort: true }
                ,{field:'customerId', width:80, title: '顾客id', hide:true}
                ,{field:'riderId', width:80, title: '骑手id', hide:true}
                ,{field:'pickUpCode', width:100, title: '收件码' }
                ,{field:'deliveryTime', width:120, title: '指定送达时间'}
                ,{field:'receivedTime', width:140, title: '接受时间' , templet: function (d) {
                        return layui.util.toDateString(d.receivedTime , "yyyy-MM-dd HH:mm:ss")
                    }}
                ,{field:'finishedTime', width:140, title: '完成时间', templet: function (d) {
                        return layui.util.toDateString(d.finishedTime , "yyyy-MM-dd HH:mm:ss")
                    }}
                ,{field:'createTime', width:140, title: '订单创建时间', templet: function (d) {
                        return layui.util.toDateString(d.createTime , "yyyy-MM-dd HH:mm:ss")
                    }}
            ]]
            ,
            response: {
                statusName: 'code', //状态字段名称
                statusCode: '200', //状态字段成功值
                msgName: 'msg', //消息字段
                dataName: 'data' //数据字段（自己创建的数据字段的一个Bean，专门用来返回数据）
            }

        });
    });



</script>


</body>
</html>